<!DOCTYPE html>
<?php
	session_start();
	$order = $_SESSION['cart'];		// 购物车内的商品信息
	$sum = $_SESSION['sum'];		// 购物车内的商品总价
	$num = $_SESSION['num'];		// 购物车内的商品总量
?>
<html>
<head>
	<meta charset="utf-8">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<title>我的订单</title>
</head>
<body>
	<div class="container">
		<h1>确认订单</h1>
		<hr>
		<a href="index.php" title="返回商品列表">←商品列表</a>
		<table>
			<tr>
				<th>商品名</th>
				<th>售价</th>
				<th>数量</th>
			</tr>
			<!-- 遍历商品数组，显示商品信息 -->
			<?php foreach ($order as $key => $value) :?>
			<tr>
				<!-- 商品名 -->
				<td><?php echo $value['name'] ?></td>
				<!-- 商品单价 -->
				<td class="price">￥<?php echo $value['price'] ?></span></td>
				<!-- 商品数量 -->
				<td class="num"><?php echo $value['num']; ?></td>
			</tr>
			<?php endforeach; ?>
			<!-- 显示商品总量和商品总价 -->
			<tr>
				<td colspan="3">
					<span>共<?php echo $num; ?>件</span>	<!-- 商品总量 -->
					小计：<span class="total">￥<?php echo $sum; ?></span>	<!-- 商品总价 -->
				</td>
			</tr>
		</table>
		<!-- 订单地址 -->
		<form action="done.php" method="post" class="address">  <!-- 第（10）空和第（11）空 -->
			<textarea name="address" placeholder="请输入邮寄地址" cols="60" required></textarea>   <!-- 第（12）空 -->
			<input type="submit" name="提交订单">
		</form>
	</div>
</body>
</html>